package com.shuyuntu.login.dao;


import com.shuyuntu.login.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @program: login
 * @Date: 2018-06-29 14:45
 * @Author: Mr.Deng
 * @Description:
 */
public interface  UserDao extends JpaRepository<User,Integer> {

    public List<User> findByName(String name);

    public List<User> findByNameAndPassword(String name,String password);

    public List<User> findById(int id);


    @Query(value = "select * from user where name = ?1 and age = ?2", nativeQuery = true)//?1表示第一个参数，?2表示第二个参数
    User findBySQL(String name, Integer age);

}
